<?php

namespace Home\Controller;

/**
 * Description of ReportPageController.class控制器实例
 *
 * @author songanwei
 * @date 2016-1-11
 */
class ReportPageController extends ParentController {

    protected function _initialize() {
        parent::_initialize();

        //检查是否已到期
        $hotelLogic = A('Common/Hotel', 'Logic');
        $result = $hotelLogic->checkHotelActive($this->hotelId);
        if ($result == false) {
            $this->messageTips(L('_HOTEL_EXPIRED_'));
        }
        // 初始化页面的startDate EndDate
        $this->assign('startDate', date('Y-m-01'));
        $this->assign('endDate', date('Y-m-d'));
    }

    /**
     * 概览页面
     * @modify AmosZhong 2016-01-18
     */
    public function index() {
        $this->display();
    }

    /**
     * 财务收支页面
     * @modify AmosZhong 2016-01-18
     */
    public function finance() {
        $this->display();
    }

    /**
     * 财务收支页面
     * @modify wenhui 2017-12-19
     */
    public function accountview() {
        $hotelId = $this->hotelId;

        $hotelLogic = A('Common/Hotel', 'Logic');
        // 支付方式
        $noCardhotelPayData = $hotelLogic->getHotelPay($hotelId, false);
        $hotelNoteData = $hotelLogic->getHotelNote($hotelId, false, null, true);

        $this->assign('noteInCome', $hotelNoteData['income']);
        $this->assign('noteOutCome', $hotelNoteData['outcome']);
        $this->assign('noCardhotelPayData', $noCardhotelPayData);

        // 获取系统货币
        $currencyLogic = A('Common/Currency', 'Logic');
        $currencyData = $currencyLogic->getBpCurrency($hotelId);
        $currencyDefaultData = my_sort($currencyData, 'type', SORT_DESC)[0];
        $this->assign('currencyInfo', $currencyData);
        $this->assign('currencyDefaultInfo', $currencyDefaultData);

        $this->display();
    }

    /**
     * 房间运营页面
     * @modify AmosZhong 2016-01-18
     */
    public function room() {
        $this->display();
    }

    /**
     * 义卖概览页面
     * @modify wenhui 2017-09-20
     */
    public function charity() {
        $this->display();
    }
}